package com.plugin.manager;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;

/**
 * @author  laowu
 * @create  2021/8/9 16:18
 * @desc  配置类
 **/
public class Config {

    public static List<Plugin> getPlugins() {
        List<Plugin> list = new ArrayList<>();
        Properties properties = new Properties();
        try {
            InputStream stream = Config.class.getClassLoader().getResourceAsStream("config.properties");
            properties.load(stream);
            list.add(new Plugin(properties.getProperty("001.name"), properties.getProperty("001.jar"), properties.getProperty("001.class")));
            list.add(new Plugin(properties.getProperty("002.name"), properties.getProperty("002.jar"), properties.getProperty("002.class")));
            list.add(new Plugin(properties.getProperty("003.name"), properties.getProperty("003.jar"), properties.getProperty("003.class")));
        } catch (IOException e) {
            e.printStackTrace();
        }
        return list;
    }
}
